package com.ll.beautymall.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.ll.beautymall.bean.Floor;
import com.ll.beautymall.ui.home.indexfragment.view.ContentFragment;

import java.util.List;

/**
 * Created by Administrator on 2016/10/20.
 */
public class HomeVpAdapter extends FragmentPagerAdapter {
    private List<ContentFragment> list;
    private List<Floor> titles;

    public HomeVpAdapter(FragmentManager fm) {
        super(fm);
    }


    public void setData(List<ContentFragment> list, List<Floor> titles) {
        this.list = list;
        this.titles = titles;
        notifyDataSetChanged();
    }

    @Override
    public Fragment getItem(int position) {
        return list != null ? list.get(position) : null;
    }

    @Override
    public int getCount() {
        return list != null ? list.size() : 0;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles != null ? titles.get(position).getTitle() : null;
    }
}
